<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title></title>
    <script src="/js/jquery-3.3.1.min.js"></script>
    <script src="//cdn.jsdelivr.net/jsbarcode/3.3.20/JsBarcode.all.min.js"></script>
    <script type="text/javascript">
        function myprint() {
            //直接调用浏览器打印功能
            bdhtml = window.document.body.innerHTML;
            //定义打印区域起始字符，根据这个截取网页局部内容
            sprnstr = "<!--startprint-->"; //打印区域开始的标记
            eprnstr = "<!--endprint-->";   //打印区域结束的标记
            prnhtml = bdhtml.substr(bdhtml.indexOf(sprnstr) + 17);
            prnhtml = prnhtml.substring(0, prnhtml.indexOf(eprnstr));
            window.document.body.innerHTML = prnhtml;
            //开始打印
            window.print();
            //还原网页内容
            window.document.body.innerHTML = bdhtml;
        }
    </script>
    <style>
        body,h2,h3{
            margin: 0;
            padding: 0;
        }
        html{
            width: 200px;
            font-size: 100px;
        }
        img{
            width: 100%;
            margin: 5px 0;
            padding: 0;
            display: block;
        }
        h2{
            font-size: 0.16rem;
        }
        h3{
            font-size: 0.14rem;
        }
    </style>

</head>
<body>


<!--startprint-->
<div class="box">
    <img  src="" alt="">
    <h3>品名：女装针织衫</h3>
    <h3>款号：HY22WZ4303</h3>
    <h3>颜色：杏色</h3>
    <h3>尺码：均码</h3>
    <h3>执行标准：FZ/T 73005-2012</h3>
    <h3><span style="margin-right: 30px;">安全技术类别：B类</span><span>检验号：01</span></h3>
    <img src="" alt="">
    <h2>全国统一零售价：￥199.0</h2>
</div>
<!--endprint-->

 <div> <a href="javascript:;" onClick="myprint();">打印</a></div>


</body>
</html>